BigDFT.Interop.DNAviewerInterop module
A module to extend the output by dna_feature_viewer.
- plot_one_field_vals(ax, xrange, field_vals, kind='bar', specs={}, errors=None, kind_specs={}, **kwargs)[source]
Plot the data in the axis with their own specification.
- class SequenceRecord(sequence, start_index=1, line_length=None)[source]
Representation of a Sequence in term of a dna_feature_viewer record.
- Parameters:
- append_sequence_field(field_vals, label='', errors=None, array_kwargs={}, **kwargs)[source]
Introduce a sequence field to be plot.
- Parameters:
field_vals (array-like) – values to be represented, in the order of sequence residues.
errors (array-like) – errorbar on to be represented, in the order of sequence residues.
label (str) – label of the values, to be put in the legend.
array_kwargs (dict) – dictionary of kargs whose values are arrays of the same length of field_vals
**kwargs – keyword arguments to be employed in the plot_one_field_vals function.
- define_interesting_chunks(chunks)[source]
Introduce the chunks to be plotted separately.
- Parameters:
chunks (list) – list of tuples (start,end) in the sequence reference. Start index is considered.
- define_highlight_regions(regions)[source]
Introduce chunks to be highlighted.
- Parameters:
chunks (dict) – tuples (start,end) as keys, and colors in the sequence reference. Start index is considered.
- split_sequence_in_groups()[source]
Define the groups in which to split the sequence representation.
- set_line_length(line_length)[source]
Define the conditions associated to the limited length in plots.
- define_axis_grids(**kwargs)[source]
Define the axis on which to plot the groups.
- Parameters:
**kwargs – arguments for py:func:matplotlib.pyplot.figure method.
- compose_record(**kwargs)[source]
Create the record from the class.
- Parameters:
**kwargs – keyword arguments for GraphicRecord.
- level_height = 0.275
- sequence_level_shrink = 0.7
- y_lower_bound = 0.3928571428571429
- y_extra_buffer = 1
- total_y_buffer = 0.6678571428571429
- lb = 0.52
- rb = 0.48
- display(total_height=None, level_offset=0, on_top_of=None)[source]
Represent record information.
- Parameters:
total_height (float) – size of the axis height.
record. (Useful when representing more than one) –
level_offset (int) – starting coordinate of the level.
on_top_of (SequenceRecord) – base record on top of which to plot the present data. Employ the groups of the base record.
- Returns:
- (fig, axsd) matplotlib figure and a dictionary of
{line: axs}, where axs is a list of matplotlib axes employed in a given line.
- Return type:
- colordict_to_feature(colordict, sequence_fragments, start_index=0, unify_same_colors=False)[source]
Create the feature data starting from a colordict.
Useful for conversion between the native representation method and the sequence one. Merge together residues which ehibit the same color.
- Parameters:
- Returns:
feature dictionary to be passed into append_feature
- Return type:
- get_data_from_field_vals(sys, field_vals, lookup=None)[source]
Extract the actual data from the field_vals keyword.
- sys_into_records(sys, features={}, shift={}, chain_labels={}, line_length=80, restrict_to={}, field_vals={})[source]
Transform a BigDFT.BioQM.BioSystem into a list of SequenceRecord.
- Parameters:
sys (bigDFT.BioQM.BioSystem) – the system to be represented.
features (dict) – dictionary of the features to plot. the dictionary can be of the form: {label: feature}, where feature may be either a string to be passed to py:func:~BigDFT.BioQM.BioSystem.fragment_values method or alternatively a colordict. If label contains the keyword
highlight
then the unify_same_colors approach is applied to the feature.shift (dict) – shift to be applied to each of the chain id.
chain_labels (dict) – label to be written in the figure title, per chain.
line_length (int) – number of residues par line.
restrict_to (dict) – dictionary of chunks to be plot per chain id.
field_vals (dict) – {label: {
data
: field_vals,kwargs
: kwargs,specs
: specs}} dictionary. Accepts also the {label: field_vals} format. In this latter case, the field vals value may also be a string which can be passed to py:func:~BigDFT.BioQM.BioSystem.fragment_values method.
- Returns:
dictionary of {label: SequenceRecord}, one per system sequence.
- Return type:
- display_records(records, *args, **kwargs)[source]
Display a stack of records.
- Parameters:
records (list) – dictionary of SequenceRecord objects to be plot one after another.
*args – further lists of objects that will be superimposed at the first argument. should have the same number of elements. Their labels are ignored in favour of the first.
**kwargs –
keyword arguments, like:
- records_lookup: list of lists indicating which
record of the first list should be associated to the records of the others. Put None for records which should not be considered in the comparison.
- Returns:
- list of (fig, axsd) tuples, containing the figure and
the matplotlib axes dictionary employed per sequence.
- Return type: